<?php
//获取公钥指纹
// 公钥字符串
$publicKey = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQDuyDsrk9HjeCwBXYnf70a9ezsCUQR6oILyPoCAr4+80vlwEOrm9KFBuSoxtoq93KQ/j6QnJvsPL3kC3KfzuWbDzrIKxf3cTjLz8yom6apT2w/3M3BxVPlTr19P265QMkoySv3irAQ7PzrRpe4fyCoKDrlSPxHfH5A9lyP1kl+pnw== pc@localhost';
// 从公钥字符串中提取公钥
$publicKeyDetails = openssl_pkey_get_public($publicKey);

if ($publicKeyDetails === false) {
    die('Failed to extract public key details');
}

// 获取公钥的指纹
$publicKeyFingerprint = openssl_pkey_fingerprint($publicKeyDetails, 'sha256');

// 输出结果
echo "Public Key Fingerprint (SHA-256): " . $publicKeyFingerprint . PHP_EOL;

// 释放公钥资源
openssl_free_key($publicKeyDetails);